const express = require('express');
const router = express.Router();
const fs = require('fs');
fs.readdir('C:\\www\\2302\\day35\\简单登录案例数据库版\\routers',(err,data)=>{
    if(err){
        return console.log(err);
    }
    // console.log(data);[ 'index.js', 'users.js' ]
    data = data.filter(item=>item !== 'index.js').map(item=>item.slice(0,-3))
    // console.log(data);


    data.forEach(item=>router.use('/'+item,require('C:/www/2302/day35/简单登录案例数据库版/routers/'+item)));
    console.log(data);
});

module.exports = router